﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CafeApp.Service;
using CafeApp.ViewModel;

namespace CafeApp.Controllers
{
    public class CapheController : Controller
    {
        //
        // GET: /Caphe/
        DM_DAYBAN_SERVICE _dm_day_Ser = new DM_DAYBAN_SERVICE();
        DM_BAN_SERVICE _dm_ban_Ser = new DM_BAN_SERVICE();
        HANG_HOA_SERVICE _hang_hoa_Ser = new HANG_HOA_SERVICE();

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult GoibanId(string id)
        {
            var item = _dm_ban_Ser.GetById(id);

            var entity_day = _dm_day_Ser.GetById(item.MADAY.Value);

            ViewBag.NameDay = entity_day.TENDAY;

            var list_hang_hoa = new List<HANGHOA>();
            list_hang_hoa.Add(new HANGHOA { MAHH = "", TENHH = "" });
             list_hang_hoa.AddRange(_hang_hoa_Ser.GetList());

             ViewData["ListHangHoa"] = new SelectList(list_hang_hoa, "MAHH", "TENHH");


            return View(item);
        }

    }
}
